package org.luxor.commons.schedule.utils;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.reflect.MethodSignature;

import java.lang.reflect.Method;

/**
 * @author Mr.yan @date 2019/10/20
 */
public class ReflectUtil {

    public static Method getMethod(ProceedingJoinPoint pjp) {
        Method method = null;
        try {
            Class<?>[] par = ((MethodSignature) pjp.getSignature()).getParameterTypes();
            method = pjp.getTarget().getClass().getMethod(pjp.getSignature().getName(), par);
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (SecurityException e) {
            e.printStackTrace();
        }
        return method;
    }
}
